package answer

var curr *ListNode

/**
 * @Description: 通过递归来实现
 */
func JudgeByRecursion(head *ListNode) bool {
	curr = head
	return recursivelyCheck(head)
}

/**
 * @Description: 递归是会先到最后一个节点
 */
func recursivelyCheck(head *ListNode) bool {
	if head == nil {
		return true
	}
	res := recursivelyCheck(head.Next) && curr.Val == head.Val
	curr = curr.Next
	return res
}
